﻿<%@ Page Title="cit.com.vn - Kết quả Khảo sát" Language="C#" Inherits="System.Web.Mvc.ViewPage<DTO.Models.SURVEY>" %>
<html>
<head>
    <title>CIT.COM.VN - KẾT QUẢ KHẢO SÁT</title>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <link href="<%= Url.Content("~/Content/style.css")%>" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        google.load("visualization", "1", { packages: ["corechart"] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            var data = new google.visualization.DataTable();

            data.addColumn('string', 'Khảo sát');
            data.addColumn('number', 'Đồng ý');
            var lenAnswer = <%= ViewData["len"] %>;
            data.addRows(lenAnswer);

            var indexLabel = 0;            
            var answer1 = '<%= Model.Answer1 %>';
            if (answer1.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total1 %>);
                indexLabel += 1;
            }

            var answer2 = '<%= Model.Answer2 %>';
            if (answer2.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total2 %>);
                indexLabel += 1;
            }

            var answer3 = '<%= Model.Answer3 %>';
            if (answer3.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total3 %>);
                indexLabel += 1;
            }

            var answer4 = '<%= Model.Answer4 %>';
            if (answer4.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total4 %>);
                indexLabel += 1;
            }

            var answer5 = '<%= Model.Answer5 %>';
            if (answer5.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total5 %>);
                indexLabel += 1;
            }

            var answer6 = '<%= Model.Answer6 %>';
            if (answer6.length != 0) {
                data.setValue(indexLabel, 0, "Lựa chọn " + (indexLabel + 1) + "");
                data.setValue(indexLabel, 1, <%= Model.Total6 %>);
                indexLabel += 1;
            }

            var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
            chart.draw(data, { width: 500, height: 200, title: '<%= Model.Question %>',
                vAxis: { title: '', titleTextStyle: { color: 'red'}, hAxis: {baseline: 2} }
            });
        }
    </script>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="padding:20px">
    <div class="dung-maincontent-show">
        <div class="dung-section">
            <div class="dung-section-border">
            </div>
            <div class="dung-section-title">KẾT QUẢ KHẢO SÁT</div>
            <div class="dung-section-content">
                <div id="chart_div"></div>
                <div class="dung-sidebar" >
                    <ul>
                        <% int k = 0; %>
                        <% if (Model.Answer1.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer1 %></li>
                        <%
                            k += 1;
                        } %>
                        <% if (Model.Answer2.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer2 %></li>
                        <%
                            k += 1;
                        } %>
                        <% if (Model.Answer3.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer3 %></li>
                        <%
                            k += 1;
                        } %>
                        <% if (Model.Answer4.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer4 %></li>
                        <%
                            k += 1;
                        } %>
                        <% if (Model.Answer5.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer5 %></li>
                        <%
                            k += 1;
                        } %>
                        <% if (Model.Answer6.Length != 0) {%>
                            <li><%= "Lựa chọn " + (k + 1).ToString()%> : <%= Model.Answer6 %></li>
                        <%
                            k += 1;
                        } %>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</body>
</html>
